﻿namespace VideoStore.Services.Translation.Base
{
    /// <summary>
    /// Defines an interface for services translation.
    /// DTO -> Entity
    /// Entity -> DTO
    /// </summary>
    public interface ITranslator
    {
        /// <summary>
        /// Translates a DTO into a new domain entity.
        /// </summary>
        /// <typeparam name="TDto">The type of the dto.</typeparam>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <param name="dto">The dto.</param>
        /// <returns></returns>
        TEntity TranslateToEntity<TDto, TEntity>(TDto dto)
            where TDto : class
            where TEntity : class;

        /// <summary>
        /// Translates a domain entity into a new DTO.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <typeparam name="TDto">The type of the dto.</typeparam>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        TDto TranslateToDto<TEntity, TDto>(TEntity entity)
            where TDto : class
            where TEntity : class;
    }
}